package 力扣日常刷题.木22二月.第02天207;

/**
 * @author 帅小伙
 * @date 2022/2/7
 * @description
 */
public class Demo24把数字翻译成字符串2 {

    public int translateNum(int num) {
        String src = String.valueOf(num);
        int[] dp = new int[src.length() + 1];
        dp[0] = 1;
        for (int i = 0; i < src.length(); i++) {
            dp[i+1] +=dp[i];
            if(i == 0)continue;
            String pre = src.substring(i-1, i+1);
            if(pre.compareTo("25") <= 0 && pre.compareTo("10") >= 0)dp[i+1] += dp[i-1];
        }
        return dp[src.length()];
    }

}
